package test;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-11-04
 * Time: 16:34
 */
public class Product {
    private String name;
    private double price;
    private int count;
    private String adds;

    public Product() {
    }

    public Product(String name, double price, int count, String adds) {
        this.name = name;
        this.price = price;
        this.count = count;
        this.adds = adds;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getAdds() {
        return adds;
    }

    public void setAdds(String adds) {
        this.adds = adds;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Product product = (Product) o;
        return Double.compare(product.price, price) == 0 && count == product.count && Objects.equals(name, product.name) && Objects.equals(adds, product.adds);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, price, count, adds);
    }

    @Override
    public String toString() {
        return "Product{" +
                "name='" + name + '\'' +
                ", price=" + price +
                ", count=" + count +
                ", adds='" + adds + '\'' +
                '}';
    }
}
